<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>保单详细信息</title>
	<link id="easyuiTheme" rel="stylesheet" type="text/css" href="../jquery-easyui-1.5.3/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../jquery-easyui-1.5.3/themes/icon.css"/>
	<script src="../resources/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.5.3/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../jquery-easyui-1.5.3/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
	    var contextPath = function() {
	        return  "/" + location.pathname.split("/")[1];
	    }
	    
		function getValue(name){
			var str=window.location.search;
			if (str.indexOf(name)!=-1){
				var pos_start=str.indexOf(name)+name.length+1;
				var pos_end=str.indexOf("&",pos_start);
				if (pos_end==-1){
					return str.substring(pos_start);
				} else {
					return str.substring(pos_start,pos_end);
				}
			} else {
				return "";
			}
		}
		
		var  themeName = getValue("theme");
		if (themeName!=""){
		    var cssurl  = $('#easyuiTheme').attr('href');  
		    var href = cssurl.substring(0, cssurl.indexOf('themes')) + 'themes/' + themeName + '/easyui.css';  
		    $('#easyuiTheme').attr('href', href);  
		}
		
	</script>


<style>
<!--
body{
	background-image:url(NoteForm/wood-bg2.jpg);
}

.exlist{
	background-color:#F9EE70;
	margin:30px auto;
	padding:5px;
	width:560px;
	min-height:200px;
	height:auto;
	font-family:"微软雅黑";
	-webkit-box-shadow:4px 4px 5px #333;/*webkit*/ 
	-moz-box-shadow:4px 4px 5px #333;/*firefox*/     
	box-shadow:4px 4px 5px #333;/*opera或ie9*/ 
}

#title{
	width:200px;
	margin:20px auto;
}

#title legend{
	font-size:26px;
}

div.exlist_title{
	background-color:#F9EE70;
	width:560px;
	height:20px;
}

div.exlist_title img{
	float:right;
	margin:-15px 10px;
}

/*-----------form-----------*/

fieldset{
	width:90%;
	border:1px dashed #666;
	margin:40px auto;
}
 
legend{
	background-color:#F9EE70;
	height:120px;
	height:30px;
	color:#630;
	font-weight:bolder;
	font-size:20px;
	line-height:30px;
	margin:-20px 10px 10px;
	padding:0 10px;
}
  
 
div.row{
	margin:10px;
	padding:5px;
}
 
div.row label{
	height:20px;
	font-size:16px;
	line-height:20px;
	margin:0 10px;
}
 
input.txt{
	background-color:#F9EE70;
	color:#333;
	width:150px;
	height:20px;
	margin:0 10px;
	font-size:16px;
	line-height:20px;
	border:none;
	border-bottom:1px solid #565656;

}
 
input.txt:focus{
	color:#333;
	background-color: #FF0;
	border-bottom:1px solid #F00;
}
 
select{
	width:100px;
}

option{
	text-align:center;
}

input.btn{
	width:50px;
	height:20px;
	color:#000008B;
	background-color: transparent;
	border:0;
	padding:0;
}


-->
</style>

</head>

<body>




<div class="exlist">
		<div class="exlist_title"><img src="NoteForm/paper-clip.png" /></div>
		<div id="title">
			<legend>保单详细信息</legend>
		</div>
		<form method="post" action="">
           <fieldset>
           <legend>基本信息</legend>
				<div class="row">
					<label>投保单号:</label>
					<input id="insure_no" name="insure_no" style="width:135px" class="txt" type="text" readonly/>
                	<label>已送次数:</label>
                	<input id="deliver_count" name="deliver_count" style="width:100px" class="txt" type="text" readonly/>
				</div>
				<div class="row">
					<label>投保人姓名:</label>
					<input id="applicant" name="applicant" style="width:120px" class="txt" type="text" style="width:135px" readonly/>
					<label>所属地区:</label>
					<input id="area" name="area" style="width:100px" class="txt" type="text" readonly/>
				</div>
				<div class="row">
                	<label>所属项目:</label>
                	<input id="project" name="project" style="width:135px" class="txt" type="text" readonly/>
                   	<label>保单状态:</label>
                   	<input id="status" name="status" class="txt" type="text" style="width:100px" readonly/>
                </div>
				<div class="row">
                	<label>投保时间:</label>
                	<input id="insure_time" name="insure_time" style="width:135px" class="txt" type="text" readonly/>
                	<label>接件日期:</label>
                	<input id="intro_time" name="intro_time" style="width:100px" class="txt" type="text" readonly/>
                </div>
				<div class="row">
					<label>备注说明:</label>
					<input id="remark" name="remark" class="txt" style="width:360px" type="text" readonly/>
				</div>
           </fieldset>
           <fieldset>
           <legend>警告及中断</legend>
				<div class="row">
					<label>当前状态:</label>
					<input id="monitor_info" name="monitor_info" style="width:360px" class="txt" type="text" />
				</div>				
				<div class="row">
		            <label>警告说明:</label>
		            <input id="warn_info" name="warn_info" style="width:360px" class="txt" type="text" />
				</div>	
           		<div class="row">
					<label>中断说明:</label>
					<input id="hold_info" name="hold_info" style="width:360px" class="txt" type="text" />
				</div>
			</fieldset>    
        </form>        
</div>
</body>


<script>
$(function(){
	
	var  insure_no = getValue("insure_no");
	
	$("div").click(function(){
		$(this).addClass("select");		
    });
	//$('#insure_no').focus();
	
	getPolicyInfo(insure_no);
	getPolicyMonitor(insure_no);
});



function getPolicyInfo(insureNO){
	$.ajax({
		type:'POST',
		url:contextPath()+'/mdmis/getPolicyInfo',
	    data:{insure_no:insureNO},
	    dataType:'json',
	    beforeSend: function () {
			$.messager.progress({ 
			       　title: '提示', 
				msg: '操作进行中，请稍候……', 
				text: '' 
			});
	    },
	    complete: function () {
			$.messager.progress('close');
	    },
	    success:function(result){
			if (result.success){
				$('#insure_no').val(result.data.insure_no);
				$('#status').val(result.data.status_info);
				$('#applicant').val(result.data.applicant);
				$('#status').val(result.data.status_info);
				$('#applicant').val(result.data.applicant);
				$('#area').val(result.data.area);
				$('#project').val(result.data.project);
				$('#deliver_count').val(result.data.deliver_count);
				$('#insure_time').val(result.data.insure_time);
				$('#intro_time').val(result.data.intro_time);
				$('#remark').val(result.data.remark);
				////////////////////////////////////////
				$('#recipient').val(result.data.applicant);
				$('#remark').val(result.data.remark);
				////////////////////////////////////////
				//$('#deliver_no').focus();
			} else {
			    $.messager.show({	// show error message
			        title: 'Error',
			        msg: result.errMsg
			    });
				$('#remark').val(result.errMsg);
			}
		}
	});
}

function getPolicyMonitor(insureNO){	
	// 获取该保单的中断信息
	$.ajax({
		type:'POST',
		url:contextPath()+'/mdmis/getPolicyMonitor',
	    data:{insure_no:insureNO},
	    dataType:'json',
	    beforeSend: function () {
			$.messager.progress({ 
			       　title: '提示', 
				msg: '操作进行中，请稍候……', 
				text: '' 
			});
	    },
	    complete: function () {
			$.messager.progress('close');
	    },
	    success:function(result){
			if (result.success){
				//判断该保单是否有存在monitor信息
				if (result.info=="null") {
					//当数据库中没有这个保单的中断信息时
					$('#monitor_info').val('系统中未发现该保单的中断信息');
					$('#warn_info').val('');
					$('#hold_info').val('');
				} else {
					//当数据库中有这个保单的中断信息时
					//加载数据库中这个保单的中断信息
					setMonitorStatus(result.data.warn_flag, result.data.hold_flag);
					$('#warn_info').val(result.data.warn_info);	
					$('#hold_info').val(result.data.hold_info);				    			
				}
			} else {
			    $.messager.show({	// show error message
			        title: 'Error',
			        msg: result.errMsg
			    });
				$('#monitor_info').val(result.errMsg);
			}
		}
	});
}

function setMonitorStatus(flag1, flag2){
	var warn_info_str = "";
	var hold_info_str = "";
	if (flag1==0 || flag1=="0" || flag1==null) {
		warn_info_str = "无";
	} else if (flag1==1001 || flag1=="1001") {
		warn_info_str = "有";
	} else {
		warn_info_str = "";
	}	
	if (flag2==0 || flag2=="0" || flag2==null) {
		hold_info_str = "无";
	} else if (flag2==2001 || flag2=="2001") {
		hold_info_str = "中断寄出";
	} else if (flag2==2002 || flag2=="2002") {
		hold_info_str = "中断回销";
	} else {
		hold_info_str = "";
	}	
	$('#monitor_info').val("【警告】" + warn_info_str + "【中断】" + hold_info_str);
}

</script>
</html>
